/*
 * @描述: 
 * @创建者: kilomChou
 * @Date: 2021-05-20 17:15:54
 * @最后编辑: kilomChou
 * @LastEditTime: 2021-05-20 17:25:43
 */

import BaseAI from "../ai/BaseAI";
import Snake from "./Snake";
import SnakeNode from "./SnakeNode";

/** 蛇AI */
export default class SnakeAI {

    /** ai行为列表 */
    ais: BaseAI[];
    /** ai共用数值 */
    aiVal: IAIVal = {};

    constructor(
        /** 蛇 */
        readonly snake: Snake) { }

    /** 每帧循环 */
    update() {
        if (this.ais) {
            this.idle();
            this.ais.forEach(ai => ai.check());
        }
    }

    /** 清除状态 */
    idle() {
        this.snake.toAng = this.snake.head.ang;
        this.snake.isSprint = false;
    }

}


export interface IAIVal {
    nearestNode?: SnakeNode,
}